<%@ taglib prefix="c" uri="http://java.sun.com/jsp/jstl/core" %>
<%@ page language="java" contentType="text/html; charset=UTF-8" pageEncoding="UTF-8"%>

<c:if test="${empty sessionScope.user}">
    <c:redirect url="error.jsp"/>
</c:if>

<!DOCTYPE html>
<html>
<head>
    <title>Service</title>
</head>
<body>

<jsp:useBean id="userDAO" class="org.example.week10.UserDAO" scope="page"/>
<c:set var="user" value="${userDAO.getUserByName(sessionScope.user)}"/>

欢迎用户 [${sessionScope.user}] 登录本系统 |
<a href="log-out">退出系统</a><br>

<c:if test="${not empty user}">
    <a href='account-deactivation?id=${sessionScope.user.id}'>账户停用</a>
</c:if>

</body>
</html>